<?php
require "common.php";
$id = $_GET['id'];
$res = mysql_query("select * from `article` where id = '$id'");
$res = mysql_fetch_assoc($res);
if ($_POST){
    $title=$_POST['title'];
    $content=$_POST['content'];
    $time=time();
    if ($title == "" ||$content == ""){
        echo "<script>alert('更新失败')</script>";
    }else{
        $res = mysql_query("update `article` set `title`= '$title',`content`='$content',`time`='$time' where `id` = '$id'");
        echo "<script>alert('更新成功'),location.href='index.php'</script>";
    }

}




require "templates/edit.html";